/*
 * @(#)FormElementType.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.form.bean;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
  FormElementType.java

  This class is the serializable bean reflecting business logic uses.

    @author           Scott Tong
    @company          DCIVision Limited
    @creation date    30/12/2003
    @version          $Revision: 1.14.26.1 $
*/

public class FormElementType {

  public static final String REVISION = "$Revision: 1.14.26.1 $";

	public static final String ELEMENT_PAGE = "1";
	public static final String ELEMENT_SECTION = "0";
  public static final String ELEMENT_TEXT = "T";
  public static final String ELEMENT_PASSWORD = "P";
  public static final String ELEMENT_TEXT_AREA = "A";
  public static final String ELEMENT_DATE_PICKER = "D";
  public static final String ELEMENT_CURRENT_DATE = "U";
  public static final String ELEMENT_CURRENT_LOGIN= "G";
  public static final String ELEMENT_SIGNATURE= "Z";
  public static final String ELEMENT_TIME_PICKER= "M";
  public static final String ELEMENT_CONDITIONAL_FIELD="B";
  public static final String ELEMENT_USER_PICKER="V";
  
  public static final String ELEMENT_SELECTION_BOX = "S";
  public static final String ELEMENT_RADIO_BUTTON = "R";
  public static final String ELEMENT_CHECK_BOX = "C";

  public static final String ELEMENT_FILE = "F";
  public static final String ELEMENT_LABEL = "L";
  public static final String ELEMENT_IMAGE = "I";
  public static final String ELEMENT_TABLE = "TA";

  public static final List ELEMENT_TEXT_LIST = new ArrayList();
  static {
    ELEMENT_TEXT_LIST.add(ELEMENT_TEXT);
    ELEMENT_TEXT_LIST.add(ELEMENT_PASSWORD);
    ELEMENT_TEXT_LIST.add(ELEMENT_TEXT_AREA);
    ELEMENT_TEXT_LIST.add(ELEMENT_DATE_PICKER);
    ELEMENT_TEXT_LIST.add(ELEMENT_TIME_PICKER);
    ELEMENT_TEXT_LIST.add(ELEMENT_CURRENT_DATE);
    ELEMENT_TEXT_LIST.add(ELEMENT_CURRENT_LOGIN);
    ELEMENT_TEXT_LIST.add(ELEMENT_SIGNATURE);
    ELEMENT_TEXT_LIST.add(ELEMENT_CONDITIONAL_FIELD);
    ELEMENT_TEXT_LIST.add(ELEMENT_USER_PICKER);
    Collections.unmodifiableList(ELEMENT_TEXT_LIST);
  }

  public static final List ELEMENT_SELECTION_LIST = new ArrayList();
  static {
    ELEMENT_SELECTION_LIST.add(ELEMENT_SELECTION_BOX);
    ELEMENT_SELECTION_LIST.add(ELEMENT_RADIO_BUTTON);
    ELEMENT_SELECTION_LIST.add(ELEMENT_CHECK_BOX);
    Collections.unmodifiableList(ELEMENT_SELECTION_LIST);
  }

  public static final List ELEMENT_ATTACH_LIST = new ArrayList();
  static {
    ELEMENT_ATTACH_LIST.add(ELEMENT_IMAGE);
    Collections.unmodifiableList(ELEMENT_ATTACH_LIST);
  }

  public static boolean isText(String type) {
    return ELEMENT_TEXT_LIST.contains(type);
  }

  public static boolean isSelection(String type) {
    return ELEMENT_SELECTION_LIST.contains(type);
  }

  public static boolean isAttachment(String type) {
    return ELEMENT_IMAGE.equals(type);
  }

  public static boolean isTable(String type) {
    return ELEMENT_TABLE.equals(type);
  }

  public static boolean isFile(String type) {
    return ELEMENT_FILE.equals(type);
  }

  public static boolean isLabel(String type) {
    return ELEMENT_LABEL.equals(type);
  }

  public static boolean isImage(String type) {
    return ELEMENT_IMAGE.equals(type);
  }
}
